package com.mapperdb.scripting.xmltags;

import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.scripting.xmltags.DynamicContext;

public class ColEqAttrSqlNode extends AttrSqlNode {
	protected String column;

	public ColEqAttrSqlNode(Result result) {
		this(result, result.property());
	}

	public ColEqAttrSqlNode(Result result, String property) {
		super(result, property);
		this.column = result.column();
	}

	@Override
	public boolean apply(DynamicContext context) {
		return super.apply(context);
	}

	@Override
	protected String format() {
		StringBuffer sb = new StringBuffer();
		sb.append(column).append(" = ");
		sb.append(super.format());
		return sb.toString();
	}
}
